package com.etc.dao;

import com.etc.entity.Talk;
import com.etc.entity.TalkExample;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface TalkMapper {
    int countByExample(TalkExample example);

    int deleteByExample(TalkExample example);

    int deleteByPrimaryKey(Integer tid);

    int insert(Talk record);

    int insertSelective(Talk record);

    List<Talk> selectByExample(TalkExample example);

    Talk selectByPrimaryKey(Integer tid);

    int updateByExampleSelective(@Param("record") Talk record, @Param("example") TalkExample example);

    int updateByExample(@Param("record") Talk record, @Param("example") TalkExample example);

    int updateByPrimaryKeySelective(Talk record);

    int updateByPrimaryKey(Talk record);
/**
 *
 * @Description: 用于查找当前用户的所属回复
 *
 * @auther: 臧浩鹏
 * @date: 14:26 2018/8/6
 * @param: [ttopicid, tcategory, tarticleid]
 * @return: java.util.List<com.etc.entity.Talk>
 *
 */
    List<Talk> searchOneLevelTalk(@Param("ttopicid") Integer ttopicid, @Param("tcategory") String tcategory, @Param("tarticleid") Integer tarticleid, @Param("tcreatetime") String tcreatetime);

    List<Talk> selectByDateTime(@Param("tcreatetime") String tcreatetime, @Param("ttopicid")Integer ttopicid,@Param("tcategory")String tcategory, @Param("tarticleid")Integer tarticleid);

    List<Talk> selectByOwnWithTime(@Param("t_uid")Integer uid,@Param("tcreatetime") String tcreatetime,@Param("fathertime") String fathertime,@Param("tcategory")String tcategory, @Param("tarticleid")Integer tarticleid);






    List<Talk> selecttalkMassage(@Param("tarticleid") Integer tarticleid, @Param("tcategory") String tcategory,@Param("ttopicid") Integer ttopicid);

	void insertMusicTalk(@Param("tcategory")String tcategory,@Param("tarticleid") Integer tarticleid,@Param("tcontent") String tcontent,@Param("ttopicid") Integer ttopicid,@Param("tUid") Integer tUid,@Param("tcreatetime") Date date);

	void insertMusicTalk(Talk talk);

    /**
     *
     * @Description: 递归删除当前评论及其下的所有评论
     *
     * @auther: 臧浩鹏
     * @date: 8:33 2018/8/11
     * @param: [tcategory, tarticleid, tcreatetime, uid]
     * @return: int
     *
     */
    int deleteTalkByDeep(@Param("tcategory")String tcategory, @Param("tarticleid")Integer tarticleid,@Param("tcreatetime") String tcreatetime, @Param("t_uid")Integer uid);

    /**
     *
     * @Description: 查找当前文章下的评论数目
     *
     * @auther: 臧浩鹏
     * @date: 8:34 2018/8/11
     * @param: [tcategory, tarticleid]
     * @return: java.lang.Integer
     *
     */
    Integer selectCommentsNums(@Param("tcategory")String tcategory, @Param("tarticleid")Integer tarticleid);

}